package com.zc.designmodel.creative.singleton;

/**
 * @author: zhuCan
 * @date: 2020/4/11 15:28
 * @description: 双重检查锁单例
 */
public class DoubleCheckSingleton {

  private volatile static DoubleCheckSingleton instance;

  private DoubleCheckSingleton(){}

  public static DoubleCheckSingleton getInstance(){
    if (instance==null){
      synchronized (DoubleCheckSingleton.class){
        if (instance==null){
          instance=new DoubleCheckSingleton();
        }
      }
    }
    return instance;
  }
}
